home *** CD-ROM | disk | FTP | other *** search
- Path: zippy.dct.ac.uk!str-ccsun!strath-cs!st-and!usenet
- Newsgroups: comp.os.ms-windows.programmer.tools.mfc,comp.lang.c++
- Subject: Re: Controls in non-dialog (mfc)
- Message-ID: <317236F8.1211@st-andrews.ac.uk>
- From: William Heitler <wjh@st-andrews.ac.uk>
- Date: Mon, 15 Apr 1996 11:46:00 +0000
- References: <4k81um$s8t@pub.news.uk.psi.net>
- Organization: University of St Andrews
- NNTP-Posting-Host: bgpc-wjh.st-and.ac.uk
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win95; I)
-
- andrew oxenburgh wrote:
- >
- > sj2393@ansys.com (Steve Jones) writes:
- > > How in MFC does one go about embedding a control within a
- > > window that is not a dialog box? For example, I can
- > > construct and Create() a CEdit object within a CView derived
- > > class, but nothing (apparently) happens. I knew when I
- > > tried it something wasn't quite right; I wasn't sure what to
- > > use for the nID. Is it necessary to use a resource?
- > >
- > >
- > > steve
- > >
- > > stevejones@ansys.com
- > >
-
- So far as I know the nID can be anything you like. To have it come up visible at the start don't
- forget to set WS_VISIBLE in the Create.
- I have:
-
- in *.h
- class CVertAxis : public CWnd // the containing class (could be from CView)
- {
- .
- .
- CEdit TopScale; // embedded edit control
- .
- .
- // Generated message map functions
- protected:
- //{{AFX_MSG(CVertAxis)
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- .
- .
- and in *.cpp
-
- int CVertAxis::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- .
- .
- if (!TopScale.Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|
- ES_MULTILINE | ES_RIGHT, rect1, this, IDC_TOPSCALE))
- {
- TRACE("Failed to create TopScale in CVertAxis");
- return -1;
- }
- .
- .
- Hope this helps.
-